有人使用了反应本机调制模块吗?
react-native-modalize模块,当我在flatListProps对象上呈现代码时,它会显示下面的错误!!
下面是https://jeremybarbet.github.io/react-native-modalize/#/EXAMPLES的例子

import React, { useRef } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import { Modalize } from 'react-native-modalize';
export const App = () => {
const modalizeRef = useRef<Modalize>(null);
const onOpen = () => {
modalizeRef.current?.open();
};
const arrayData = [ { "heading": "test"}, {"heading": "test2"}... ]
let data = { "object": [arrayData] }
const getData = () => ({ data });
const renderItem = (item) => (
<View>
<Text>{item.heading}</Text>
</View>
);
return (
<>
<TouchableOpacity onPress={onOpen}>
<Text>Open the modal</Text>
</TouchableOpacity>
<Modalize
ref={modalizeRef}
flatListProps={{
data: getData(),
renderItem: renderItem,
keyExtractor: item => item.heading,
showsVerticalScrollIndicator: false,
}}
/>
</>
);
}发布于 2021-01-21 13:15:04
data of flatListProps是一个数组对象。
let data = { "object": [arrayData] }
const getData = () => ([ ...data.object ]);https://stackoverflow.com/questions/65828051
复制相似问题