Skip to content

Release: v5.0.0 - new architecture only #709

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 14 commits into from
May 23, 2025
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
105 changes: 4 additions & 101 deletions .github/workflows/ReactNativeSlider-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,38 +89,10 @@ jobs:
- name: Run TypeScript on the sources
run: cd example && npx tsc --noEmit

build-android-app-old-arch:
name: Build example app Android
runs-on: ubuntu-latest
needs: [verify-example-sources]

steps:
- uses: actions/checkout@v4

- name: Pull the npm dependencies
run: npm install

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Use old arch config
id: cache-old-arch-gradle
uses: actions/cache@v4
env:
cache-name: cached-gradle-old-arch-prop
with:
path: example/android/gradle.properties
key: gradle-prop-old-arch-config

- name: Build the Android OS app
run: cd example/android && ./gradlew assembleDebug

build-android-app-new-arch:
name: Build example app Android (Fabric)
runs-on: ubuntu-latest
needs: [build-android-app-old-arch]
needs: [verify-example-sources]

steps:
- uses: actions/checkout@v4
Expand All @@ -136,58 +108,10 @@ jobs:
- name: Build the Android OS app
run: cd example/android && ./gradlew assembleDebug

build-iOS-app:
name: Build example app iOS
runs-on: macos-latest
needs: [verify-example-sources]
steps:
- uses: actions/checkout@v4

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cached-ios-npm-deps
with:
path: example/node_modules
key: ${{ hashFiles('./example/package-lock.json') }}-${{ hashFiles('./package/package-lock.json') }}

- name: Install required dependencies on cache miss (npm)
if: steps.cache-npm.outputs.cache-hit != 'true'
run: |
npm install

- name: Cache Pods
id: cache-pods
uses: actions/cache@v4
env:
cache-name: cached-ios-pods-deps
with:
path: example/ios/Pods
key: ${{ hashFiles('./example/ios/Podfile.lock') }}

- name: Install required dependencies on cache miss (Pods)
if: steps.cache-pods.outputs.cache-hit != 'true'
run: |
cd example/ios && pod install

- name: Reinstall Pods only if using cached ones
if: steps.cache-pods.outputs.cache-hit == 'true'
run: cd example/ios && pod install

- name: Use the current package sources in build
run: cd example && npm run refresh-package

- name: Build iOS
run: |
xcodebuild -workspace example.xcworkspace -scheme example -destination "platform=iOS Simulator" CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO SKIP_BUNDLING=TRUE build | xcbeautify --renderer github-actions
working-directory: example/ios


build-iOS-new-arch-app:
name: Build example app iOS (Fabric)
runs-on: macos-latest
needs: [build-iOS-app]
needs: [verify-example-sources]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -220,34 +144,13 @@ jobs:
- name: Install required dependencies on cache miss (Pods)
if: steps.cache-pods.outputs.cache-hit != 'true'
run: |
cd example/ios && RCT_NEW_ARCH_ENABLED=1 pod install
cd example/ios && pod install

- name: Reinstall Pods only if using cached ones
if: steps.cache-pods.outputs.cache-hit == 'true'
run: cd example/ios && RCT_NEW_ARCH_ENABLED=1 pod install
run: cd example/ios && pod install

- name: Build iOS - Fabric
run: |
xcodebuild -workspace example.xcworkspace -scheme example -destination "platform=iOS Simulator" CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE=NO SKIP_BUNDLING=TRUE build | xcbeautify --renderer github-actions
working-directory: example/ios


build-Windows-app:
name: Build example app Windows
runs-on: windows-2022
needs: [verify-example-sources]
steps:
- name: Ensure the cross-platform Git on Windows
run: git config --global core.autocrlf false

- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: npm install

- name: Restore NuGet packages
run: nuget restore .\example\windows\example.sln

- name: Build the Windows OS app
run: cd example; npx react-native run-windows --arch x64 --no-launch --no-deploy --logging --sln .\windows\example.sln --proj .\windows\example\example.vcxproj
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ buck-out/
\.buckd/
*.keystore
!debug.keystore
.kotlin/

# fastlane
#
Expand Down
54 changes: 1 addition & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ To use this library you need to ensure you are using the correct version of Reac

| `@react-native-community/slider` version | Required React Native Version |
| ---------------------------------------- | ---------------------------- |
| `5.0.0` | `>=0.76` |
| `4.5.1` | `>=0.69` |
| `4.3.0` | `>=0.64` |
| `4.x.x` | `>=0.60`; `>=0.62` (on Windows); |
Expand Down Expand Up @@ -225,59 +226,6 @@ You can also do this manually by:
- Installing pods for iOS app
- Running example app like always: `npx react-native run-<platform>`

### New architecture setup (Fabric)

In order to use the new architecture some extra steps are needed.
#### iOS
- Install pods with new arch flag inside `example/ios` folder: `RCT_NEW_ARCH_ENABLED=1 pod install`
- Run `npm run example-ios`

#### Android
- Set `newArchEnabled` to true inside `example/android/gradle.properties`
- Run `npm run example-android`

<details>
<summary>
If you are using React Native version lower than 0.70, you need to setup manual linking for Android to work.
</summary>

Inside `example/android/app/src/main/jni/Android.mk` add these lines:

```diff
+ include $(NODE_MODULES_DIR)/@react-native-community/slider/android/build/generated/source/codegen/jni/Android.mk
include $(CLEAR_VARS)
```

```diff
libreact_codegen_rncore \
+ libreact_codegen_ReactSlider \
libreact_debug \
```

Inside `example/android/app/src/main/jni/MainComponentsRegistry.cpp` update these lines:

```diff
#include <react/renderer/components/rncore/ComponentDescriptors.h>
+ #include <react/renderer/components/ReactSlider/ComponentDescriptors.h>

...

MainComponentsRegistry::sharedProviderRegistry() {
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();

// Custom Fabric Components go here. You can register custom
// components coming from your App or from 3rd party libraries here.
//
// providerRegistry->add(concreteComponentDescriptorProvider<
// AocViewerComponentDescriptor>());
+ providerRegistry->add(concreteComponentDescriptorProvider<RNCSliderComponentDescriptor>());

return providerRegistry;
}
```

</details>

## Maintainers

- [Bartosz Klonowski](https://github.com/BartoszKlonowski) - [Callstack](https://callstack.com/)
Expand Down
7 changes: 7 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ ruby ">= 2.6.10"
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'
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ 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
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'

android {
ndkVersion rootProject.ext.ndkVersion
Expand Down
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ buildscript {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
targetSdkVersion = 35
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.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 2 additions & 3 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +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 -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || 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 @@ -206,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
5 changes: 0 additions & 5 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ target 'example' do
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'exampleTests' do
inherit! :complete
# Pods for testing
end

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
Expand Down
Loading
Loading