Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions example/.bundle/config

This file was deleted.

14 changes: 11 additions & 3 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
source 'https://rubygems.org'
source "https://rubygems.org"

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem "cocoapods", ">= 1.13", "!= 1.15.0", "!= 1.15.1"
gem "activesupport", ">= 6.1.7.5", "!= 7.1.0"
gem "xcodeproj", "< 1.26.0"
gem "concurrent-ruby", "< 1.3.4"

# Ruby 3.4.0 has removed some libraries from the standard library.
gem "bigdecimal"
gem "logger"
gem "benchmark"
gem "mutex_m"
14 changes: 5 additions & 9 deletions example/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
* @format
*/

import 'react-native'
import React from 'react'

// Note: import explicitly to use the types shiped with jest.
import { it } from '@jest/globals'

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer'
import ReactTestRenderer from 'react-test-renderer'
import App from '../App'

it('renders correctly', () => {
renderer.create(<App />)
test('renders correctly', async () => {
await ReactTestRenderer.act(() => {
ReactTestRenderer.create(<App />)
})
})
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def enableProguardInReleaseBuilds = false
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class MainApplication : Application(), ReactApplication {
load()
}
}
}
}
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 35
ndkVersion = "27.2.12479018"
kotlinVersion = "2.1.20"
ndkVersion = "27.1.12297006"
kotlinVersion = "2.0.21"
}
repositories {
google()
Expand Down
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
Expand Down
2 changes: 2 additions & 0 deletions example/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
20 changes: 14 additions & 6 deletions example/components/RemoteDataSetExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ export const RemoteDataSetExample = memo((props: Omit<IAutocompleteDropdownProps
return
}
setLoading(true)
const response = await fetch('https://jsonplaceholder.typicode.com/posts').then(
data =>
new Promise(res => {
setTimeout(() => res(data.json()), 2000) // imitate of a long response
}),
)
const response = await fetch('https://jsonplaceholder.typicode.com/posts')
.then(
data =>
new Promise(res => {
setTimeout(() => res(data.json()), 2000) // imitate of a long response
}),
)
.catch(error => {
console.error('Error fetching data:', error)
throw error
})
.finally(() => {
setLoading(false)
})
const items = (await response) as Record<string, string>[]

const suggestions = items
Expand Down
13 changes: 11 additions & 2 deletions example/components/RemoteDataSetExample2.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { memo, useCallback, useRef, useState } from 'react'
import type { TextInput } from 'react-native'
import { Button, Dimensions, Text, View } from 'react-native'
import type {
IAutocompleteDropdownRef,
Expand All @@ -13,7 +14,7 @@ export const RemoteDataSetExample2 = memo((props: Omit<IAutocompleteDropdownProp
const [selectedItem, setSelectedItem] = useState<string | null>(null)
const dropdownController = useRef<IAutocompleteDropdownRef | null>(null)

const searchRef = useRef(null)
const searchRef = useRef<TextInput>(null)

const getSuggestions = useCallback(async (q: string) => {
const filterToken = q.toLowerCase()
Expand All @@ -23,7 +24,15 @@ export const RemoteDataSetExample2 = memo((props: Omit<IAutocompleteDropdownProp
return
}
setLoading(true)
console.log('fetching data')
const response = await fetch('https://jsonplaceholder.typicode.com/posts')
.catch(error => {
console.error('Error fetching data:', error)
throw error
})
.finally(() => {
setLoading(false)
})
const items = (await response.json()) as AutocompleteDropdownItem[]
const suggestions = items
.filter(item => item.title?.toLowerCase().includes(filterToken))
Expand All @@ -40,7 +49,7 @@ export const RemoteDataSetExample2 = memo((props: Omit<IAutocompleteDropdownProp
}, [])

const onOpenSuggestionsList = useCallback((isOpened: boolean) => {
console.log({ isOpened })
console.log('onOpenSuggestionsList cb', { isOpened })
}, [])

return (
Expand Down
7 changes: 7 additions & 0 deletions example/components/RemoteDataSetExample3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ export const RemoteDataSetExample3 = memo(() => {
}
setLoading(true)
const response = await fetch('https://jsonplaceholder.typicode.com/posts')
.catch(error => {
console.error('Error fetching data:', error)
throw error
})
.finally(() => {
setLoading(false)
})
const items = (await response.json()) as AutocompleteDropdownItem[]
const suggestions = items
.filter(item => item.title?.toLowerCase().includes(filterToken))
Expand Down
Loading