Skip to content

Update repo and example to React Native 0.73 #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 24, 2024
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
13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
new_arch_ios_build_only:
executor:
name: rn/macos
xcode_version: '15.0.0'
xcode_version: '15.3.0'
steps:
- checkout
- run:
Expand All @@ -50,7 +50,7 @@ jobs:
e2e_release_ios:
executor:
name: rn/macos
xcode_version: '15.0.0'
xcode_version: '15.3.0'
steps:
- checkout
- run:
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
path: ./artifacts


e2e_release_android_new_arch:
new_arch_android_build_only:
executor:
name: android/android-machine
resource-class: large
Expand Down Expand Up @@ -164,9 +164,6 @@ jobs:
name: build app for e2e tests
# - android/wait-for-emulator
# - android/disable-animations
- run:
command: yarn detox:android:test:release
name: run e2e tests
- store_artifacts:
path: ./artifacts

Expand All @@ -191,12 +188,12 @@ workflows:
- analyse_js
- e2e_release_ios
- e2e_release_android
- e2e_release_android_new_arch
- new_arch_android_build_only
- new_arch_ios_build_only
- publish:
requires:
- e2e_release_android
- e2e_release_android_new_arch
- new_arch_android_build_only
- e2e_release_ios
- new_arch_ios_build_only
filters:
Expand Down
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ node_modules/react-native/Libraries/polyfills/.*

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
.*/test/.*

[include]

Expand Down Expand Up @@ -63,4 +64,4 @@ untyped-import
untyped-type-import

[version]
^0.182.0
^0.217.0
2 changes: 1 addition & 1 deletion RNDateTimePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = package['license']
s.author = package['author']
s.homepage = package['homepage']
s.platforms = { :ios => "11.0", :visionos => "1.0" }
s.platforms = { :ios => "11.0", :visionos => "1.0" }
s.source = { :git => "https://github.com/react-native-community/datetimepicker", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,cpp}"
s.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactcommunity.rndatetimepicker">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application />
</manifest>
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const isLintingOrTesting =
module.exports = {
presets: [
[
'module:metro-react-native-babel-preset',
'module:@react-native/babel-preset',
// this is a workaround for some deeper issue
{useTransformReactJSXExperimental: !isLintingOrTesting},
],
Expand Down
4 changes: 3 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
.gradle/
.idea/
.vs/
.xcode.env
Pods/
build/
dist/
dist/*
!dist/.gitignore
local.properties
msbuild.binlog
node_modules/
4 changes: 3 additions & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
IOS_MODE,
ANDROID_DISPLAY,
IOS_DISPLAY,
} from '../src/constants';
} from '@react-native-community/datetimepicker/src/constants';
import * as RNLocalize from 'react-native-localize';

const timezone = [
Expand Down Expand Up @@ -632,3 +632,5 @@ const styles = StyleSheet.create({
width: 350,
},
});

export default App;
31 changes: 24 additions & 7 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
buildscript {
def androidTestAppDir = "../../node_modules/react-native-test-app/android"
apply(from: "${androidTestAppDir}/dependencies.gradle")
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())

repositories {
mavenCentral()
Expand All @@ -18,14 +26,23 @@ allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("${rootDir}/../../node_modules/react-native/android")
url({
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native/android")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native`");
}())
}
maven {
// All of Detox' artifacts are provided via the npm module
url "$rootDir/../../node_modules/detox/Detox-android"
}
mavenCentral()
google()
maven {
// All of Detox' artifacts are provided via the npm module
url "$rootDir/../../node_modules/detox/Detox-android"
}
}
afterEvaluate { project ->
def androidExtension = project.extensions.findByName('android')
Expand Down
32 changes: 20 additions & 12 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,28 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of Flipper to use with React Native. Default value is whatever React
# Native defaults to. To disable Flipper, set it to `false`.
FLIPPER_VERSION=false

# Enable Fabric at runtime.
#USE_FABRIC=1

# Enable new architecture, i.e. Fabric + TurboModule - implies USE_FABRIC=1.
# Jetifier randomly fails on these libraries
android.jetifier.ignorelist=hermes-android

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
# Note that this is incompatible with web debugging.
#newArchEnabled=true
#bridgelessEnabled=true

# Uncomment the line below to build React Native from source.
#react.buildFromSource=true

# Uncomment the line below if building react-native from source
#ANDROID_NDK_VERSION=21.4.7075529
# Version of Android NDK to build against.
#ANDROID_NDK_VERSION=26.1.10909125

# Version of Kotlin to build against.
#KOTLIN_VERSION=1.7.10
#KOTLIN_VERSION=1.8.22
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 22 additions & 13 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# 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

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
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,
# 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.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
21 changes: 11 additions & 10 deletions example/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -42,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
11 changes: 10 additions & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ pluginManagement {

rootProject.name = "date-time-picker-example"

apply(from: "../../node_modules/react-native-test-app/test-app.gradle")
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/test-app.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())
applyTestAppSettings(settings)
3 changes: 3 additions & 0 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
};
2 changes: 1 addition & 1 deletion example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import {AppRegistry} from 'react-native';
import {App} from './App';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
11 changes: 5 additions & 6 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
require_relative '../../node_modules/react-native-test-app/test_app'
ws_dir = Pathname.new(__dir__)
ws_dir = ws_dir.parent until
File.exist?("#{ws_dir}/node_modules/react-native-test-app/test_app.rb") ||
ws_dir.expand_path.to_s == '/'
require "#{ws_dir}/node_modules/react-native-test-app/test_app.rb"

workspace 'date-time-picker-example.xcworkspace'

# Flipper causes the build to fail on release when fabric is enabled
# https://github.com/facebook/react-native/issues/33764

use_flipper! false unless ENV['ENABLE_FLIPPER']

use_test_app!
Loading