Autofill is not working with android react native - react-native

<TextInput
autoCompleteType="username"
importantForAutofill="yes"
/><TextInput
autoCompleteType="password"
importantForAutofill="yes"
/>
I've added this code as per guidance in react-native, but in my android app autofill password from google or any not working.Thanks in advance.

the working solution for both platforms for RN > 0.66 is:
<TextInput
textContentType="password"
autoComplete="password"
/>
textContentType - IOS (https://reactnative.dev/docs/0.66/textinput#textcontenttype-ios)
autoComplete - Android (https://reactnative.dev/docs/0.66/textinput#autocomplete-android)

Related

How to test React Native "Pressable" onPress function

Here is my react native code
<Pressable
onPress={handleSignIn}>
<Text style={styles.linkTextStyle}>{signInLinkText}</Text>
</Pressable>
I want to write unit test case with react native testing library to test onPress function. Could some help me on this?
I believe you can just use the react native testing library docs here https://callstack.github.io/react-native-testing-library/docs/api/#fireeventpress-element-reacttestinstance--void. It shows you all the possibilities of react native testing library which is really good.

How can I insert an admob banner into my app?

I need to insert an admob banner in the app, I followed a lot of tutorials on internet but any of thoose works. Can someone help me? I'm using an android emulator
the code I used with react native admob is:
import {
AdMobBanner,
AdMobInterstitial,
PublisherBanner,
AdMobRewarded,
} from 'react-native-admob'
....
<View>
<AdMobBanner
adSize="fullBanner"
adUnitID="ca-app-pub-2174326550695558/6129769558"
onAdFailedToLoad={error => console.error(error)}
/>
</View>
but It gives me and error:<< Invariant Violation:requireNativeComponent:"RNGADBannerView" was not found in the UIManager>>
You can use react-native-firebase for admob, it's works like charm for my app.

How to make a text to speech work in background in React Native app?

I have a question that I have not been able to solve for some time and I have not been able to do it yet. Do you know how to make a text to speech work in background React Native Android app?
If you want sounds to work on iOS in background mode you need to do 2 things:
enable audio capabilities in xcode
configure AVAudioSession. There is already a package for it here: https://github.com/BonnierNews/react-native-audio-session
I did this at the root of the project, using react-native-sound, but should be the same with react-native-audio-session:
import Sound from 'react-native-sound';
Sound.setCategory('Playback'); // this will play sound in background
Somewhere in your background runner:
Tts.speak('Some text);
We can use ACCESSIBILITY.Accessibility, means making your apps usable to both normal users and users with disabilities. Any person can have one or more form of disability.
Step1:-
Turn on TalkBack in your device Settings
Open your device's Settings app Settings app.>>Open Accessibility>> then TalkBack.>>Turn on TalkBack.
then add following props to every component of ReactNative.
accessible={true}
accessibilityLabel={label}
Like this:-
return (
<TouchableOpacity
accessible={true}
accessibilityLabel={label}
accessibilityTraits={"button"}
accessibilityComponentType={"button"}
onPress={() => {
onPress(data.name);
}}
>
<Icon
name={icon}
style={styles.icon}
size={icon_size}
color={icon_color}
/>
</TouchableOpacity>
)

React Native: Android TextInput autoCorrect={false} does not disable suggestions

autoCorrect={false} is suppose to force no suggestions mode, and therefore no underlining of text in the input field but it's not working.
UPDATE 8/18/18: It seems to disable the suggestions but not the underlining.
It's a bug in React Native but you can use : keyboardType="visible-password" to disable autocorrect suggestions.
autoCorrect={false} is working some of android phones on my project but If you use with keyboardType="visible-password" is work on my project!
this is a bug in React Native.
https://github.com/facebook/react-native/issues/18457
Your options for now are probably to:
wait for a fix to come out
or submit a PR to fix the issue in React Native
or write your own native module for text input that has the correct behavior

ReactNative onResponderRelease doesn't work on Android

I tried to use ScrollView's onResponderRelease event on an android device, but it dosen't work fine. Code like this:
<ScrollView
onResponderRelease = {()=>{console.log('release')}}
/>
I saw many react-native libs used this api like this.
Does it support android platform ?
Yes, it has such problem - you can read more about this https://github.com/facebook/react-native/issues/9447
Try to use 'onMomentumScrollEnd', in some cases it will do exactly what do you expect:
<ScrollView
onMomentumScrollEnd = {()=>{console.log('release on Android')}}
onResponderRelease = {()=>{console.log('release on IOS')}}
/>