Skip to content
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

feat: Publish fabric and classic architecture release #1308

Merged
merged 117 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
cec0c26
Adds new fabric example
Ubax Jan 7, 2022
7640e12
adds iOS fabric changes
Ubax Jan 7, 2022
139a35b
Adds JS code of PoC and links it in package json
Ubax Jan 7, 2022
94331d0
Adds screens iOS PoC
Ubax Jan 7, 2022
91d72f1
Adds patches
Ubax Jan 7, 2022
e3a96c2
Changes prop show to hidden
Ubax Jan 7, 2022
8c010f5
Adds README
Ubax Jan 7, 2022
054ae53
Adds fabric changes for android
Ubax Jan 10, 2022
93217e4
Adds patch for emulator localhost
Ubax Jan 10, 2022
9a00c71
Adds react native as source dependency
Ubax Jan 10, 2022
e7f91e4
Adds native necessary files
Ubax Jan 10, 2022
f835211
Adds android changes to basic screens components
Ubax Jan 10, 2022
69af2ba
Removes leftover comments from Android code
Ubax Jan 10, 2022
75e42aa
Refactors JS components
Ubax Jan 11, 2022
59ab207
Removes leftover comments
Ubax Jan 11, 2022
0aaba53
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 11, 2022
1fc6d23
Refactors JS components
Ubax Jan 11, 2022
6d12b61
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 11, 2022
9d505a9
Add resolve plugin
Ubax Jan 11, 2022
8fb1188
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 11, 2022
84e027e
Removes leftover comments
Ubax Jan 11, 2022
73c5abf
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 11, 2022
f2b353e
Renames includes on iOS to use rnscreens
Ubax Jan 11, 2022
da1226c
Removes _controller=nil from recycle
Ubax Jan 12, 2022
d6c0b0e
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 12, 2022
77b12b3
Adds information about Java 11 to README
Ubax Jan 12, 2022
d9bedb3
Fixes events dispatching in screen
Ubax Jan 13, 2022
3fdd3cd
Removes unsued code
Ubax Jan 13, 2022
114303c
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 13, 2022
60fab66
Adds example with react navigation
Ubax Jan 13, 2022
5c0fefe
Adds dismiss event to iOS
Ubax Jan 13, 2022
35b438b
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 13, 2022
811cb8f
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Jan 13, 2022
27e6b64
Remove safe area java code
Ubax Jan 24, 2022
8300aa7
Fix pop animation with props (JS + iOS)
Ubax Jan 24, 2022
b078768
Removes conditions from events notifications
Ubax Jan 25, 2022
27314c9
Fixes ios clang format
Ubax Jan 25, 2022
25c9504
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 25, 2022
f4a37fb
Fixes android format command
Ubax Jan 25, 2022
a88f709
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Jan 25, 2022
8ff3184
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Jan 25, 2022
b6eae2d
Adds check for key in screen stack children
Ubax Jan 25, 2022
e3a47da
Probable solution if mutations order changes
Ubax Jan 27, 2022
4157680
Update react native version and remove patches
Ubax Jan 27, 2022
3ff4603
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Jan 27, 2022
fdebee4
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Jan 27, 2022
bff934b
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Jan 27, 2022
50404fc
Adds more props to header config
Ubax Jan 31, 2022
d746f90
Adds JS more complex example
Ubax Jan 31, 2022
36cc005
Fix unintentional change to ScreensSpec
Ubax Jan 31, 2022
28d19c4
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Jan 31, 2022
3ce017a
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Jan 31, 2022
84cd443
Merge branch '@ubax/fabric-fix-pop-animation' into @ubax/fabric-add-m…
Ubax Jan 31, 2022
30850d4
Changes unmounting to use mounting observer
Ubax Jan 31, 2022
3236937
Merge branch '@ubax/fabric-fix-pop-animation' into @ubax/fabric-add-m…
Ubax Jan 31, 2022
3060d55
Fixes back button title on iOS
Ubax Feb 4, 2022
5ec3e2e
Adds new props to Android Header Config
Ubax Feb 4, 2022
d7bb845
Adds example with chapters
Ubax Feb 4, 2022
74462ff
Improves demo on Android
Ubax Feb 7, 2022
0cb0f5e
Adds common to files and publishes tgz
Ubax Feb 7, 2022
97a67c2
Updates README to mention fabric
Ubax Feb 7, 2022
61c9eda
Adds combined podspec for paper and fabric
Ubax Feb 7, 2022
11b9e0a
Adds screens as tgz dependency to example app
Ubax Feb 7, 2022
09b6007
Updates podfile in FabricExample
Ubax Feb 7, 2022
c9c572c
Adds codegen generated android files
Ubax Feb 7, 2022
d1887fe
Updates podfile in FabricExample
Ubax Feb 7, 2022
57e645b
Merge branch '@ubax/publish-poc' into @ubax/publish-fabric-classic
Ubax Feb 7, 2022
8c8d6c6
Updates fabric readme to include android changes
Ubax Feb 7, 2022
b0defb1
Adds flags to enble fabric
Ubax Feb 9, 2022
0d83832
Reverts example app to base version
Ubax Feb 9, 2022
071bdb6
Merge branch 'main' into @ubax/publish-fabric-classic
Ubax Feb 9, 2022
ca51fce
Fixes minor bugs in index file
Ubax Feb 9, 2022
06ef57a
Merge branch 'main' into @ubax/fabric-example-app-3
Ubax Feb 9, 2022
5c71ccc
Merge branch '@ubax/fabric-example-app-3' into @ubax/fabric-ios-poc
Ubax Feb 9, 2022
fe3e241
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Feb 9, 2022
4e650fb
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Feb 9, 2022
344aa01
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Feb 9, 2022
9e7d2b1
Merge branch '@ubax/fabric-fix-pop-animation' into @ubax/fabric-add-m…
Ubax Feb 9, 2022
b3102f1
Marges add-more-features to publish-poc
Ubax Feb 9, 2022
6a0f07d
Marges add-more-features to publish-poc
Ubax Feb 9, 2022
c992af7
Merge branch '@ubax/publish-poc' into @ubax/publish-fabric-classic
Ubax Feb 9, 2022
3eb5b7a
Adds cast to Screen so it works on 0.64
Ubax Feb 9, 2022
9654ac4
Adds cast to Screen so it works on 0.64
Ubax Feb 9, 2022
5e2da1f
Another minor change in index
Ubax Feb 9, 2022
e41fd1b
Changes podspec to use RCT_NEW_ARCH_ENABLED flag on iOS
Ubax Feb 10, 2022
10f3bee
Unifies Podfile in example app with RN 68
Ubax Feb 10, 2022
668a8a7
Add gradle function to 'remove' generated files on Android
Ubax Feb 10, 2022
eca2524
Add gradle function to 'remove' generated files on Android
Ubax Feb 10, 2022
d358096
Updates fabric readme
Ubax Feb 11, 2022
ed412ef
Adds condition for different screen on fabric and paper
Ubax Feb 11, 2022
c59ae3b
Removes hacks from gradle and uses sourceSets
Ubax Feb 11, 2022
69e63ae
Adds flex to ScreenStack
Ubax Feb 11, 2022
2ed283e
Update README fabric
Ubax Feb 11, 2022
dbc1c5c
Removes leftover .gitignore
Ubax Feb 11, 2022
33dd3b7
Cleans code and prepares for release
Ubax Feb 14, 2022
0f545e2
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Feb 14, 2022
b484d5f
Cleans code and prepares for release
Ubax Feb 14, 2022
24a4db6
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Feb 14, 2022
53f9b78
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Feb 14, 2022
b4cf6d9
Merge branch '@ubax/fabric-fix-pop-animation' into @ubax/publish-fabr…
Ubax Feb 14, 2022
4796975
Refactors updateProps in Header Config
Ubax Feb 14, 2022
36f47cc
Adds platform specific props comment
Ubax Feb 14, 2022
5198eb7
Fixes controller typo
Ubax Feb 14, 2022
48f688c
Merge branch '@ubax/fabric-ios-poc' into @ubax/fabric-android-poc
Ubax Feb 14, 2022
a72df9e
Formats build gradles
Ubax Feb 14, 2022
da0ba74
Merge branch '@ubax/fabric-android-poc' into @ubax/fabric-navigation-…
Ubax Feb 14, 2022
743fa87
Merge branch '@ubax/fabric-navigation-example' into @ubax/fabric-fix-…
Ubax Feb 14, 2022
641e5a5
Merge branch '@ubax/fabric-fix-pop-animation' into @ubax/publish-fabr…
Ubax Feb 14, 2022
65db4b1
Removes rn patch for m1
Ubax Feb 14, 2022
d267301
Changes package version back
Ubax Feb 14, 2022
b99af0d
Adds small changes to Readme
Ubax Feb 14, 2022
17fe593
Updates Podfile.lock
Ubax Feb 14, 2022
b15e62a
Adds missing whitespaces
Ubax Feb 14, 2022
3a8396e
Adds warning for unimplemented subview
Ubax Feb 14, 2022
60632f7
Applies proposals from code review
Ubax Feb 15, 2022
eb3d555
Updates Fabric Readme
Ubax Feb 15, 2022
e56f572
Merge branch 'main' into @ubax/publish-fabric-classic
Ubax Feb 15, 2022
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
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ android/keystores/debug.keystore

# generated by bob
lib/

# for android paper implementations
!android/build
android/build/*
!android/build/generated/
android/build/generated/*
!android/build/generated/source
android/build/generated/source/*
!android/build/generated/source/codegen
android/build/generated/source/codegen/*
!android/build/generated/source/codegen/java/
151 changes: 42 additions & 109 deletions FabricExample/App.js
Original file line number Diff line number Diff line change
@@ -1,112 +1,45 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/

import React from 'react';
import type {Node} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';

import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';

const Section = ({children, title}): Node => {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
};

const App: () => Node = () => {
const isDarkMode = useColorScheme() === 'dark';

const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};

return (
<SafeAreaView style={backgroundStyle}>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
import {createNativeStackNavigator} from '@react-navigation/native-stack';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to use v5 version of native-stack since it will get all the files straight from our repo? If not, could you check if we files imported from react-native-screens inside @react-navigation/native-stack are taken from our repo and not as some other version in its node_modules?

import {NavigationContainer} from '@react-navigation/native';
import {I18nManager} from 'react-native';
import Chapter from './src/Chapter';
import chapters from './src/chapters';
import HeaderDemo from './src/HeaderDemo';
import {WHITE} from './src/colors';
import {enableFabric} from 'react-native-screens';

const Stack = createNativeStackNavigator();

enableFabric();

const App = () => (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerHideBackButton: true,
direction: I18nManager.isRTL ? 'rtl' : 'ltr',
}}>
<Stack.Screen
name="Chapter"
options={{
title: 'Fabric Example',
headerShown: false,
}}
initialParams={{
index: 0,
chapters: chapters,
chapterRoute: 'Chapter',
afterChapterRoute: 'HeaderDemo',
}}
component={Chapter}
/>
<Stack.Screen
name="HeaderDemo"
component={HeaderDemo}
options={{title: 'Header Demo', headerTintColor: WHITE}}
/>
</Stack.Navigator>
</NavigationContainer>
);

export default App;
19 changes: 19 additions & 0 deletions FabricExample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# React Native Screens example app that uses fabric architecture

## Installing & running application

Before running application you need to install all dependencies. To do that:
- In project's root directory run `yarn install`
- In FabricExample directory run `yarn install`

### Android

To run this application on Android you need to have Java 11 active on your computer. You can check which version you are using by running `javac --version`. You can change it by changing `JAVA_HOME` environment variable or in Android Studio settings.

Then you can run this application by `yarn android` or from Android Studio.

### iOS

To run on iOS first go to `FabricExample/ios` and run `RCT_NEW_ARCH_ENABLED=1 pod install`. This will install pods for Fabric architecture.

Then in `FabricExample` run `yarn ios` or run application from Xcode.
10 changes: 10 additions & 0 deletions FabricExample/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"


import com.android.build.OutputFile

Expand Down Expand Up @@ -292,3 +294,11 @@ def isNewArchitectureEnabled() {
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

react {
reactRoot = rootProject.file("../node_modules/react-native/")
codegenDir = rootProject.file("../node_modules/react-native-codegen/")
jsRootDir = rootProject.file("../")
libraryName = "screens_fabric_app"
codegenJavaPackageName = "com.screensexample"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.fabricexample.BuildConfig;
import com.fabricexample.newarchitecture.components.MainComponentsRegistry;
import com.fabricexample.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
import com.swmansion.rnscreens.RNScreensComponentsRegistry;

import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -95,6 +97,7 @@ public JSIModuleProvider<UIManager> getJSIModuleProvider() {
// The one that is generated with the template contains no components
// and just provides you the one from React Native core.
MainComponentsRegistry.register(componentFactory);
RNScreensComponentsRegistry.register(componentFactory);

final ReactInstanceManager reactInstanceManager = getReactInstanceManager();

Expand Down
5 changes: 4 additions & 1 deletion FabricExample/android/app/src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
# If you wish to add a custom TurboModule or Fabric component in your app you
# will have to include the following autogenerated makefile.
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
include $(REACT_ANDROID_DIR)/../../react-native-screens/android/src/main/jni/Android.mk

include $(CLEAR_VARS)

LOCAL_PATH := $(THIS_DIR)
Expand Down Expand Up @@ -42,7 +44,8 @@ LOCAL_SHARED_LIBRARIES := \
librrc_view \
libruntimeexecutor \
libturbomodulejsijni \
libyoga
libyoga \
librnscreens_modules

LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall

Expand Down
4 changes: 2 additions & 2 deletions FabricExample/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand All @@ -37,4 +37,4 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions FabricExample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'FabricExample' do
config = use_native_modules!
Expand Down
Loading