ref attribute in tag is not working, using Typescript + React(with hooks)
I have this component in react: export function Graph (props: {items: Promise<graphData[]>}) { const [graphData, setGraphData] = useState([{date: new Date(), value: 10}]); const refOne =...
View ArticleHow to make KeyboardAvoidingView working properly?
I created the following sign up screen component with KeyboardAvoidingView:const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', paddingHorizontal: 10, }, text: { alignSelf:...
View ArticleReact Navigation 4.x tabBarOptions not working Typescript
Please do not recommend me to use React Navigation 5.x, i use 4.x because of the switchNavigator, anyways. i'm having issues with the React Navigation 4.x after i migrated my project to typescript,...
View ArticleTS2740 Type is missing the following properties from ReadOnly error in React...
Since StatelessComponent is deprecated, I am trying to turn all the components into classes.I have an interface, for example: interface MyInterface{ prop1: number; prop2: boolean;}And I use it in the...
View Articleexpected spyOn function to be called Jest
im currently trying to test the methods that i have created and the methods in my if statement are not being called. and im completely at a loss. I am new too jest though so im sure its something...
View ArticleWarning: Can't perform a React state update on an unmounted component React...
I don't know why I'm facing this issue. If anyone knows how to deal with it so please help. Thanks in advanceWarning: Can't perform a React state update on an unmounted component. This is a no-op, but...
View ArticleHow to import a reusable component from theme folder in react native?
I want to import a reusable Button component from theme folder. This is the path of the Button component:\app\theme\components\Button.tsAnd this is the code of Button.tsimport { typography } from...
View Articleerror An unexpected error occurred:...
After uninstalling the react-native-clii run this command to initiate a RN project with typescript template:npx react-native init MyApp --template react-native-template-typescriptbut i got this...
View ArticleWhy do my React Context Helper functions use outdated state?
Thank you for taking a look at this... Here's my problem; in my react native app I have written a React Context that manages "Header Messages" that I can call anywhere in the code base and attach a...
View ArticleUse undefined instead of null in RealmJS
I am wondering if there is a way to force RealmJS return undefined instead of null on optional fields?I am asking this, because typescript's optional types is actually T | undefined, not T | null. I...
View ArticleHow i can fix error with added AppMetrica to react-native project
I tried add "react-native-appmetrica": "^1.1.0" to my react-native project.When i tried to AppMetrica.activateWithApiKey("key") it gives an error: TypeError: null is not an object (evaluating...
View ArticleDraw d3-axis with react, without direct D3 DOM manipulation
Im making a data visualization using d3 and react. Im trying to use react to render and d3 just for make calculations.To draw X-Axis I have a <g> with a reference and to render the X-axis I just...
View ArticleHow do I import a file containing styles in react native?
For example in my project there are a few Input elements in different files. The styling of the Input elements has to be the same in all the files. The styling of the Input elements are written in a...
View ArticleType "" is not assignable to type 'typeof TouchableNativeFeedback & typeof...
How do I merge the types properly?const Button: React.FC<ButtonProps> = (props) => { const RenderButton: typeof TouchableNativeFeedback & typeof TouchableWithoutFeedback & typeof...
View ArticleHow to solve syntax error, unexpected token, export type?
I was using version 2.x of react-navigation, now I'm migrating to version 5.x. I have installed all modules according to the documentation, but on running the application, I get this error.It seems...
View ArticleClose button round icon for Android and iOS using React Native
I am trying to create a close button with clickable action. here, I need to design round close button icon and place it top of right corner in the view. How to achieve this using react-native?enter...
View ArticleHow to detect application first launch in react native app?
In my scenario, I am having three different screens like Page1, Page2, Page3. Here, if the user last visited page 2 then next time if user open application, instead of showing page1 need to show page2....
View ArticleReact-Native undefined Unable to resolve module
I am trying to import a class I made in typescript, and initialize it to pass with my view components. But when I try to initialize the class, I get the following error:Error message in emulatorMy...
View ArticleRegex to accept only 7 types of special characters
In my react-native application, I have a requirement to accept 7 types of special characters in a string. It could be all 7, few of them or none of them. Special characters are (),@'/-so the accepted...
View ArticleTS lint firing errors when creating logic for passing data to a previous...
Below is a code snippet taken from the react-navigation documentation on how to pass data to a previous screen. React.useEffect(() => { if (route.params?.post) { // Post updated, do something with...
View Article