-
Notifications
You must be signed in to change notification settings - Fork 357
[0.74] Add support for Fabric & Bridgeless Mode #516
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
Conversation
@gre please let me know if I can help somehow in getting this reviewed/merged 👍 |
This is great! thank you. |
It should work out of the box for iOS. I would appreciate if you folks can help with testing this 👍 |
Any word on shipping this? My android app is missing a core feature without it. |
Can we merge it or ship it as an alpha version? cc: @cortinico @gre |
I don't have write access to this repo so I can't merge it. We'll have to wait for @gre to reivew and merge it |
I'll test it, merge and release an alpha tomorrow 👍 |
currently testing it on alpha channel https://www.npmjs.com/package/react-native-view-shot/v/4.0.0-alpha.0 |
Thanks y'all! Can confirm 4.0.0-alpha.0 was downloaded. However, I can't seem to run it on Android, although iOS is working. Did try clean, resync Gradle, and rebuild. Whether it's Release or Debug, I'm getting the following errors when I build Android:
|
@alexanderblackh This will only work with RN version 0.74 and above. It requires lates RN changes as mentioned in PR description regarding InteropUIBlockListener |
Exactly |
Hi @cortinico , I can confirm you that Thanks & Appreciated. |
@ErHarinderSingh The
I made a quick test and everything works fine on iOSI used an App I already have installed called MetroReload, but for sake's of completeness:
This quick script, creates a new app called MetroReload, install the dependencies, open Xcode, Visual Code and start metro. My package.json now is: {
"name": "MetroReload",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.74.0-rc.6",
"react-native-view-shot": "^3.8.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.77",
"@react-native/eslint-config": "0.74.77",
"@react-native/metro-config": "0.74.77",
"@react-native/typescript-config": "0.74.77",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
} I slightly modified the App.tsx file with the following content. /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React, {useRef} from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
Button,
} from 'react-native';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import ViewShot from 'react-native-view-shot';
type SectionProps = PropsWithChildren<{
title: string;
}>;
function Section({children, title}: SectionProps): React.JSX.Element {
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>
);
}
function App(): React.JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const ref = useRef();
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
const takeSnapshot = () => {
ref.current?.capture().then(uri => {
console.log(uri);
});
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<ViewShot
ref={ref}
options={{fileName: 'MainScreen', format: 'jpg', quality: 0.9}}>
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Button title="Take Snapshot" onPress={takeSnapshot} />
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</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>
</ViewShot>
</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',
},
});
export default App; Upon clicking on the Take Screenshot button, the console logs this: ![]() And if I open the image, I can see this (notice that's correct, given that the So, my conclusion is that |
Fixes #469
Fixes #452
This PR adds support for Bridgeless & Fabric as of React Native 0.74.
To test it you need to either wait for RC5 (out next week) or build from source as there is a change needed inside React Native core to make this work:
I've tested it on RN-Tester from
main
, here the results.@gre I'd like to get your support to do some further testing.
Testing