|
|
@@ -34,10 +34,16 @@ import shareTitle from "./moment_unit";
|
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
|
let FlatList;
|
|
|
+let useActionSheet;
|
|
|
+let RefreshControl;
|
|
|
+let useSafeAreaInsets;
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
|
|
|
+ RefreshControl = require("react-native").RefreshControl
|
|
|
useRoute = require("@react-navigation/native").useRoute
|
|
|
useNavigation = require("@react-navigation/native").useNavigation
|
|
|
FlatList = require('react-native').FlatList
|
|
|
+ useSafeAreaInsets = require('react-native-safe-area-context').useSafeAreaInsets
|
|
|
}
|
|
|
|
|
|
let timer;
|
|
|
@@ -64,6 +70,13 @@ export default function MomentMain() {
|
|
|
const [pageTop, setPageTop] = useState(0)
|
|
|
const scrollRef = useRef()
|
|
|
|
|
|
+ let showActionSheetWithOptions;
|
|
|
+ let insets:any
|
|
|
+ if (process.env.TARO_ENV == 'rn') {
|
|
|
+ showActionSheetWithOptions = useActionSheet()
|
|
|
+ insets = useSafeAreaInsets();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
let router
|
|
|
let navigation;
|
|
|
@@ -366,18 +379,21 @@ export default function MomentMain() {
|
|
|
|
|
|
function more() {
|
|
|
showActionSheet({
|
|
|
+ showActionSheetWithOptions: showActionSheetWithOptions,
|
|
|
title: '',
|
|
|
itemList: ['个人主页', '我的搭子', '消息通知'],
|
|
|
success: (index) => {
|
|
|
switch (index) {
|
|
|
case 0:
|
|
|
- jumpPage('/_moment/pages/home?uid=' + user.id)
|
|
|
+ jumpPage('/_moment/pages/home?uid=' + user.id, 'UserHome', navigation, {
|
|
|
+ uid: user.id
|
|
|
+ })
|
|
|
break;
|
|
|
case 1:
|
|
|
- jumpPage('/_moment/pages/relation')
|
|
|
+ jumpPage('/_moment/pages/relation', 'Relation', navigation)
|
|
|
break
|
|
|
case 2:
|
|
|
- jumpPage('/_moment/pages/message')
|
|
|
+ jumpPage('/_moment/pages/message', 'Message', navigation)
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
@@ -472,6 +488,7 @@ export default function MomentMain() {
|
|
|
}
|
|
|
|
|
|
function wxList() {
|
|
|
+
|
|
|
return <ScrollView style={{
|
|
|
marginTop: navigationBarHeight,
|
|
|
height: '90vh'
|
|
|
@@ -549,17 +566,34 @@ export default function MomentMain() {
|
|
|
return <FlatList
|
|
|
style={{
|
|
|
marginTop: navigationBarHeight,
|
|
|
- height: screenHeight-navigationBarHeight
|
|
|
+ height: screenHeight - navigationBarHeight-(insets?insets.bottom:0)-40,
|
|
|
+ backgroundColor: '#fff'
|
|
|
}}
|
|
|
data={moments}
|
|
|
- keyExtractor={item => item.link.event_id}
|
|
|
+ keyExtractor={(item,index) => {
|
|
|
+ // console.log(item,index)
|
|
|
+ return index
|
|
|
+ }}
|
|
|
renderItem={({ item, index }) => <MomentItem data={item} del={
|
|
|
() => {
|
|
|
var list = JSON.parse(JSON.stringify(moments))
|
|
|
list.splice(index, 1)
|
|
|
setMoments(list)
|
|
|
}
|
|
|
- } />}
|
|
|
+ }
|
|
|
+ />}
|
|
|
+ refreshControl={
|
|
|
+ <RefreshControl
|
|
|
+ tintColor='black'
|
|
|
+ colors={['black']} // 设置刷新指示器的颜色为白色
|
|
|
+ progressBackgroundColor="black" // 设置刷新指示器的背景颜色为白色
|
|
|
+ refreshing={isPulling}
|
|
|
+ onRefresh={onRefresh}
|
|
|
+ />
|
|
|
+ }
|
|
|
+ onEndReached={loadMore} // 上拉加载更多
|
|
|
+ onEndReachedThreshold={0.5} // 当距离底部还有 50% 的高度时触发加载
|
|
|
+ ListFooterComponent={<ListFooter noMore={noMore} loading={loading} />} // 加载指示器
|
|
|
/>
|
|
|
}
|
|
|
|