I'm developing app with RN 0.69.6. I am trying to create scrollable item horizontally with ScrollView
Only on main screen in my app it works but on other screens in my app it doesn't work.
But, the scrolling it's also works on iOS but not on Android.
Output of npx react-native info System: OS: Windows 10 10.0.19044 CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU # 1.80GHz Memory: 1.95 GB / 11.85 GB Binaries: Node: 16.14.2 - C:\\Program Files\\nodejs\\node.EXE Yarn: 1.22.19 - \~\\AppData\\Roaming\\npm\\yarn.CMD npm: 8.17.0 - C:\\Program Files\\nodejs\\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio: Not Found Languages: Java: Not Found npmPackages: #react-native-community/cli: Not Found react: 18.0.0 =\> 18.0.0 react-native: 0.69.6 =\> 0.69.6 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found
renderHighlightVideoBanner = (banners) => {
return (
<View style={styles.highlightOverflowContainer}>
<View style={styles.groupTitleContainer}>
<AdjustableText additionalStyle={styles.headerLabel}>What To Watch</AdjustableText>
</View>
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={styles.horizontalScrollViewContainer}
>
{banners.data.map((value) => {
return (
<View style={styles.container}>
<TouchableOpacity
style={styles.touchableHighlightSliderContainer}
onPress={() => this.navigateToVideoScreen(value)}
>
<Image
resizeMode="cover"
style={styles.sliderImage}
source={{ uri: value.file_path + value.file_name }}
/>
</TouchableOpacity>
<View style={styles.highlightTitleLabelContainer}>
<AdjustableText heading="label" additionalStyle={styles.headerLabel}>{value.title}</AdjustableText>
<AdjustableText heading="label">{value.subtitle}</AdjustableText>
</View>
</View>
)
})}
</ScrollView>
</View>
)
}
The banner can scroll horizontally
Related
The app is crashing while i Load this component in the view. It used to working before.
import {Picker, View} from 'native-base';
<View style={{flex:1}}>
<Picker mode="dropdown">
<Picker.Item label="Select" value={0} />
<Picker.Item label="Veg" value={0} />
<Picker.Item label="Non-Veg" value={0} />
</Picker>
</View>
it seems like native base picker has a dependency for #react-native-community/picker
try to install it via
npm install #react-native-community/picker
npx pod-install
once installed it will fix the issue for you
I have a react-native app.
I have an app but when i use icons(react-native-vector-icons) the icon show in japanese, example:
The icon that i want to use is "add"
Icon
But when i show the icon on my app that show like this:
bug
The code of this app is:
Code
Code:
const App = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<Header />
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
<Icon name="add" color="#000" size={22} />
</Text>
</View>
</ScrollView>
</SafeAreaView>
</>
);
};
});
React-native Doctor:
Common
✓ Node.js
✓ yarn
Android
✖ JDK
- Version found: 1.8.0_265
- Version supported: >= 8
✖ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME
Errors: 2
Warnings: 0
Usage
› Press f to try to fix issues.
› Press e to try to fix errors.
› Press w to try to fix warnings.
› Press Enter to exit.
got same issue.Follow this instruction :
Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
And rebuild.
I developed mobile app which has video player in react native.
Then I built both Android and iOS app from the react native project.
But it's working well in Android but not playing in iOS.
If you've ever experienced this problem, please help me.
This is code and package information.
<WebView
allowsFullscreenVideo={true}
style={{ aspectRatio: 1.6, backgroundColor: "#000000", flex: 1 }}
source={{ uri: 'https://sample.mp4' }}
/>
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-webview": "^8.0.3",
This code works for me in android and ios
<View style={{ height: 300 }}>
<WebView
style={{flex: 1.0}}
javaScriptEnabled={true}
domStorageEnabled={true}
source={{uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' }}/>
</View>
Environment
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU # 3.00GHz
Memory: 1.35 GB / 7.87 GB
Binaries:
Node: 10.15.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5791312
React Native version: 0.60.4
Code
<FlatList
style={{
flexDirection: 'row',
marginHorizontal: -wp('3%'),
zIndex: 40
}}
initialNumToRender={10}
data={this.state.data}
horizontal={true}
key={item => item.groupNo}
keyExtractor={(item, index) => index.toString()}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
ref={ref => (this.flatList = ref)}
renderItem={({ item }) => (
<Item item={item} />
)}
/>
Steps To Reproduce
Added some data to my FlatList
Add horizontal={true} property to flatlist
Set I18nManager.allowRTL(true)
Set I18nManager.forceRTL(true)
Make my renderItem component extend as PureComponent.
Using Real Android Device
As you see below when my app is running on RTL direction FlatList automatically scrolls to top/first of the list but LTR direction is OK!
RTL:
LTR:
I also have a same this problem, and my solution (you add them in your Flatlist).
Hope help you.
This link maybe help you improve your list:
https://github.com/filipemerker/flatlist-performance-tips
getItemLayout={(data, index) => (
{ length: LECTURE_ITEM_HEIGHT, offset: LECTURE_ITEM_HEIGHT * index, index }
)}
maxToRenderPerBatch={20}
initialNumToRender={10}
windowSize={10}
removeClippedSubviews={true}
it's a major issue, also causes a problem with react-native-calendars.
for now, you can check onScroll event, on init it causes major scroll event, you can simply return false there and block the scroll.
I hope a better solution will come in the next verisons.
try to make the trick as explained in example with onEndReached method.
https://snack.expo.io/r1NMSxFwr
Also try to play with initialNumToRender.
the best and easy way is to install this npm
https://www.npmjs.com/package/react-native-autoscroll-flatlist
Contents did showing up perfectly inside emulator and debug with real device but does not showing anything when testing out with real device (using released .apk). It just only showed blank container with white color. Or do i missed something?
<WebView
ref={(wView) => {this.wView = wView}}
javaScriptEnabled={true}
// onBridgeMessage={this.onBridgeMessage}
onMessage={this.onMessage}
injectedJavaScript="window.postMessage = String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage');"
automaticallyAdjustContentInsets={false}
domStorageEnabled={true}
startInLoadingState={true}
source={mainHtml} <-- load with, var mainHtml = require('./MainHtml.html');
style={{width: 320,height:100,flex: 1}}/>
Environment
react-native-cli: 2.0.1
react-native: 0.43.4
react: 16.0.0-alpha.6
Device(ASUS Zenfone)
Android version 6.0.1
From what I've read here this is a known issue with Android when deploying in Release. The workaround is to point to the file with a uri:
{ uri: 'file:///pathto/file.html' }