问题描述
我使用 Android 9 并且 React Native(expo) 的 textAlign 'justify' 应该可以工作,并且在大多数情况下都可以。但是,我发现了一个不太容易重现的奇怪行为,但在某些情况下 textAlign 'justify' 会引入不需要的换行符。
在执行预期操作的代码下方:
import React from 'react';
import { StyleSheet,Text,SafeAreaView,Dimensions } from 'react-native';
export default function App() {
return (
<SafeAreaView>
<Text style={styles.normal_text}>blablablabla super interesting and fun character to play since she can use a lot of different cards for her build,and sometimes adapt her hand to the scenario. However,because she needs careful planning,she’s the </Text>
<Text style={styles.normal_text}>Lorem Ipsum</Text>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
normal_text: {
fontSize: 25,textAlign: 'justify',width:Dimensions.get('window').width - 24,},});
结果:
import React from 'react';
import { StyleSheet,Dimensions } from 'react-native';
export default function App() {
return (
<SafeAreaView>
<Text style={styles.normal_text}>blablabla super interesting and fun character to play since she can use a lot of different cards for her build,});
结果:
有什么想法吗?
给你加油!
解决方法
我不能只评论所以我要回答。
只需在此处删除字符串末尾的空格:
AndroidNotificationDetails(
'id','your channel name','your channel description',importance: Importance.max,priority: Priority.high,showWhen: false,icon: "mipmap/launcher_icon"); //the important part
CALCULATE(SUM('Table'[Total]),FILTER('Table','Table'[Date]=MAX('Table'[Date])))