I'm develop an app in re-natal platform which is based on ClojureScript and React Native. I have an issue to disable RTL for my application in Android platform.
this is the code to disable RTL in react-native which works totally fine:
const ReactNative = require('react-native');
ReactNative.I18nManager.allowRTL(false);
And I think this is the exact above code in cljs:
(def ReactNative (js/require "react-native"))
(.allowRTL (.I18nManager ReactNative) false)
However, I got this error:
"Object is not a function (evaluating 'my-app.android.core.ReactNative.I18nManager())"
react-native: "v0.50.3"
react: "16.0.0"
re-frame: "0.9.2"
clojurescript: "1.9.542"
clojure: "1.9.0-alpha16"
screenshot of error
I18nManager is a field (not a method) of ReactNative object. It should be accessed like this: (.-I18nManager ReactNative). So, the equivalent of
ReactNative.I18nManager.allowRTL(false);
will be
(.allowRTL (.-I18nManager ReactNative) false)
Related
I have simple application react native with expo.
My code is:
const html = require('./assets/web/index.html');
export default (): any => <WebView source={html} />;
Problem is that web page is loaded as pure html on android device. On IOS device it is working perfectly.
I am using react-native-webview
11.23.0
Any tips how can I fix my issue?
Google, SO and githu issues
I'm trying to develop React Native Expo app on Zebra Scanner OS android. I want to listen pressed F Keys or any physical keyboard events on main screen without text input. So far I tried couple of npm package but they didn't solve my problem.
And keyboard expo doc only works for 'keyboardDidShow' and 'keyboardDidHide'
Does anyone know how to handle keyevents on React Native Expo ?
https://github.com/chronsyn/react-native-keyevent-expo-config-plugin
This code didn't work.
import KeyEvent from 'react-native-keyevent';
useEffect(() => {
KeyEvent.onKeyDownListener((keyEvent) => {
console.log(`onKeyDown keyCode: ${keyEvent.keyCode}`);
console.log(`Action: ${keyEvent.action}`);
console.log(`Key: ${keyEvent.pressedKey}`);
});
KeyEvent.onKeyMultipleListener((keyEvent) => {
console.log(`onKeyDown keyCode: ${keyEvent.keyCode}`);
console.log(`Action: ${keyEvent.action}`);
console.log(`Key: ${keyEvent.pressedKey}`);
});
});
using react-navigation v6 and can't figure out how to make the header work as iOS on android.
On android the header seems like it rendered on top of component screen. I'm using 'pan' as softwareKeyboardLayoutMode with expo.
app.config.ts
android: {
...
softwareKeyboardLayoutMode: 'pan',
},
I found the root cause <Animated.View entering={FadeIn}> that seems to mess up how react-navigation does layout
https://github.com/software-mansion/react-native-reanimated/issues/3368
Rewrote all the animations to use Animated from react-native
Is onLayout working only for android ? in my chat application i used
onLayout={() => flatListRef.current.scrollToEnd({ animated: true })}
for lifting text chat showed in flat list above keyboard but it working fine for android but not working for ios ..what will be the solution for ios to lifted text chat above the keyboard for ios
I am creating an APP using managed expo react native.
And want to implement Toast alerts, react-native provides Toast only for Android not for IOS.
I googled it and found the couple of modules which works on Android and ios but they required some config change in Native code. But as I said I am working on Managed expo app. So, I don't have access for that.
Now let me know how I can implement Toast on this?
Thanks.
As toast is a native feature in android, for ios try snakbar.
import {
ToastAndroid,
Platform
} from "react-native";
import Snackbar from 'react-native-snackbar';
notify = (message) => {
if (Platform.OS != 'android') {
Snackbar.show({
text: message,
duration: Snackbar.LENGTH_SHORT,
});
} else {
ToastAndroid.show(message, ToastAndroid.SHORT);
}
}
** If you are on expo
https://snack.expo.io/#mainak/snackbar
You can use third-party library native-base available for both react-native-cli and expo
[Native-Base] https://docs.nativebase.io/docs/GetStarted.html
[Toast Component] https://docs.nativebase.io/Components.html#toast-def-headref