** I have some issue when adding just Button !!**
and in the app that's the error
java.lang.string cannot be cast to com.facebook.react.uimanager.accessibility DelegateUtil$accessibilityRole
my simple code
import React, { Component } from "react";
import { StyleSheet, TextInput, View, Button, Text } from "react-native";
export default class App extends Component {
state = {
placeName: ""
};
placeNameChangeHandler = val => {
this.setState({
placeName: val
});
};
onPressLearnMore = () => {
alert("Pressed");
};
render() {
return (
<View style={styles.container}>
<Button
onPress={this.onPressLearnMore}
title="Learn More"
color="#841584"
/>
<TextInput
style={{
width: 300,
borderBottomWidth: 1,
borderBottomColor: "#333"
}}
placeholder="Enter Name.."
value={this.state.placeName}
onChangeText={this.placeNameChangeHandler}
/>
</View>
);
}
Yeah, it's a bug in react-native 0.57.3
but react-native 0.57.2
has its own issues!
So you have to downgrade to react-native 0.57.1
that is a bit more stable!
Do the following things in command prompt in the root directory of your project (these steps install some missed dependencies of this version):
1) delete your node_modules
directory (command: rmdir node_modules /s
in windows)
2) npm i -S [email protected]
3) npm add @babel/runtime
4) npm i -D [email protected]
5) npm i
now you can safely run react-native run-android
or react-native run-ios
.
hope this works for you (as it does for me).
It's a bug in react-native version 0.57.3
so downgrading react-native
version to 0.57.1
would be the workaround
Change the react-native version in package.json to explicitly be 0.57.1
, not ^0.57.1
and delete node_modules
folder
then do
npm i
Check here for updates regarding the issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With