Skip to content

Commit 64ccdae

Browse files
committed
功能修改
1 parent a220a89 commit 64ccdae

File tree

7 files changed

+225
-21
lines changed

7 files changed

+225
-21
lines changed

ios/ReactNativeMobxFrame.xcodeproj/project.pbxproj

Lines changed: 121 additions & 9 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"react-native-shimmer-placeholder": "^1.0.35",
4444
"react-native-snap-carousel": "^3.8.0",
4545
"react-native-svg": "^9.5.1",
46+
"react-native-swipeout": "^2.3.6",
4647
"react-native-video": "^4.4.4",
4748
"react-navigation": "^3.7.1",
4849
"react_native_countdowntimer": "^1.0.5",
@@ -52,6 +53,7 @@
5253
"devDependencies": {
5354
"@babel/core": "^7.4.3",
5455
"@babel/runtime": "^7.4.3",
56+
"@babel/template": "^7.7.4",
5557
"babel-jest": "^24.7.1",
5658
"jest": "^24.7.1",
5759
"metro-react-native-babel-preset": "^0.53.1",

src/navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { headerOptions, RouteConfigs, } from './commons/components/navConfig';
1515
// import { HomeTab, MineTab, DetailsView, CenterView, LoginView, OnePageView, TwoPageView, VideoPage, PlaceHolderPage, FontAdapterPage, DragListItemPage } from './root';
1616
import { AppColors, AppStyles } from './commons/styles/index';
1717
import CustomTabComponent from './commons/components/Tab';
18-
import { PageName } from './root';
18+
import { PageName, NavPages } from './root';
1919
const TabBarText = {
2020
home: '首页',
2121
centertext: '新增',

src/pages/center/DragListItem/index.js

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ import AppStyles from '../../../commons/styles/styles';
2323
import AppColors from '../../../commons/styles/colors';
2424
import DragSortableView from 'react-native-drag-sort';
2525
import { screen, dFont, aWidth, aHeight, } from '../../../commons/utils/screenUtils';
26+
import Swipeout from 'react-native-swipeout';
27+
import { Toast } from 'teaset';
2628

2729

2830
export default class Index extends Component {
2931

3032
static navigationOptions = ({ navigation }) => ({
31-
headerTitle: 'Item拖动',
33+
headerTitle: 'Item拖动,侧滑',
3234
});
3335

3436

@@ -47,14 +49,48 @@ export default class Index extends Component {
4749
}
4850

4951

50-
renderDeleteItem(item, index) {
52+
editItem(item, index) {
53+
Toast.message('编辑******' + index)
54+
}
55+
56+
deleteItem(item, index) {
57+
Toast.message(item.name + '****' + index)
58+
this.state.firstData.splice(index, 1);
59+
60+
let data = [];
61+
this.state.firstData.map((item, index) => {
62+
data.push(item)
63+
})
64+
65+
this.setState({
66+
firstData: data
67+
})
68+
}
69+
70+
renderItem(item, index) {
71+
let swipeoutBtns = [
72+
{
73+
text: '编辑',
74+
backgroundColor: 'green',
75+
onPress: () => this.editItem(item, index)
76+
77+
},
78+
{
79+
text: '删除',
80+
backgroundColor: 'red',
81+
onPress: () => this.deleteItem(item, index)
82+
83+
}
84+
]
5185
return (
52-
<View style={{ backgroundColor: 'blue', }}>
53-
<View style={{ flexDirection: 'row', paddingRight: 19, width: screen.width, height: 50, alignItems: 'center' }}>
54-
<Text style={{ color: 'red', fontSize: 13 }}>{item.name}</Text>
86+
<Swipeout right={swipeoutBtns}>
87+
<View style={{ backgroundColor: 'blue', }}>
88+
<View style={{ flexDirection: 'row', paddingRight: 19, width: screen.width, height: 50, alignItems: 'center' }}>
89+
<Text style={{ color: 'white', fontSize: 13 }}>{item.name}</Text>
90+
</View>
91+
<View style={{ height: 0.5, backgroundColor: AppColors.dark9 }} />
5592
</View>
56-
<View style={{ height: 0.5, backgroundColor: AppColors.dark9 }} />
57-
</View>
93+
</Swipeout>
5894
)
5995
}
6096
_keyExtractor = (item, index) => {
@@ -110,7 +146,7 @@ export default class Index extends Component {
110146

111147
}}
112148
renderItem={(item, index) => {
113-
return this.renderDeleteItem(item, index)
149+
return this.renderItem(item, index)
114150
}}
115151
/>
116152
</ScrollView>

src/pages/center/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class Index extends Component {
8686
width: '100%', alignItems: 'center', paddingVertical: 20,
8787
backgroundColor: 'yellow', marginTop: 10
8888
}} onPress={() => this._dragListItem()}>
89-
<Text style={{ color: 'black', fontSize: 18 }}>item拖动</Text>
89+
<Text style={{ color: 'black', fontSize: 18 }}>item拖动,侧滑</Text>
9090
</TouchableOpacity>
9191

9292
</View>

src/root.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import DragListItemPage from './pages/center/DragListItem';
1313

1414

1515

16-
16+
/**
17+
* 页面添加时使用该值
18+
*/
1719
export const PageName = {
1820
HomeTab,
1921
MineTab,
@@ -31,6 +33,9 @@ export const PageName = {
3133

3234

3335

36+
/**
37+
* 跳转页面时使用该值跳转
38+
*/
3439
export const NavPages = {
3540
HomeTab: 'HomeTab',
3641
MineTab: 'MineTab',

yarn.lock

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@
211211
version "7.4.3"
212212
resolved "http://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.4.3.tgz#eb3ac80f64aa101c907d4ce5406360fe75b7895b"
213213

214+
"@babel/parser@^7.7.4":
215+
version "7.7.7"
216+
resolved "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937"
217+
214218
"@babel/plugin-external-helpers@^7.0.0":
215219
version "7.2.0"
216220
resolved "http://registry.npm.taobao.org/@babel/plugin-external-helpers/download/@babel/plugin-external-helpers-7.2.0.tgz#7f4cb7dee651cd380d2034847d914288467a6be4"
@@ -561,6 +565,14 @@
561565
"@babel/parser" "^7.4.0"
562566
"@babel/types" "^7.4.0"
563567

568+
"@babel/template@^7.7.4":
569+
version "7.7.4"
570+
resolved "https://registry.npm.taobao.org/@babel/template/download/@babel/template-7.7.4.tgz?cache=0&sync_timestamp=1574465948896&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftemplate%2Fdownload%2F%40babel%2Ftemplate-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b"
571+
dependencies:
572+
"@babel/code-frame" "^7.0.0"
573+
"@babel/parser" "^7.7.4"
574+
"@babel/types" "^7.7.4"
575+
564576
"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.0", "@babel/traverse@^7.4.3":
565577
version "7.4.3"
566578
resolved "http://registry.npm.taobao.org/@babel/traverse/download/@babel/traverse-7.4.3.tgz#1a01f078fc575d589ff30c0f71bf3c3d9ccbad84"
@@ -583,6 +595,14 @@
583595
lodash "^4.17.11"
584596
to-fast-properties "^2.0.0"
585597

598+
"@babel/types@^7.7.4":
599+
version "7.7.4"
600+
resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.7.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193"
601+
dependencies:
602+
esutils "^2.0.2"
603+
lodash "^4.17.13"
604+
to-fast-properties "^2.0.0"
605+
586606
"@cnakazawa/watch@^1.0.3":
587607
version "1.0.3"
588608
resolved "http://registry.npm.taobao.org/@cnakazawa/watch/download/@cnakazawa/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef"
@@ -1517,7 +1537,7 @@ create-react-class@15.6.0:
15171537
loose-envify "^1.3.1"
15181538
object-assign "^4.1.1"
15191539

1520-
create-react-class@^15.6.2, create-react-class@^15.6.3:
1540+
create-react-class@^15.6.0, create-react-class@^15.6.2, create-react-class@^15.6.3:
15211541
version "15.6.3"
15221542
resolved "http://registry.npm.taobao.org/create-react-class/download/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036"
15231543
dependencies:
@@ -3249,6 +3269,10 @@ lodash@^4.17.11, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.6.1:
32493269
version "4.17.11"
32503270
resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.11.tgz?cache=0&other_urls=http%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
32513271

3272+
lodash@^4.17.13:
3273+
version "4.17.15"
3274+
resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.15.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
3275+
32523276
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
32533277
version "1.4.0"
32543278
resolved "http://registry.npm.taobao.org/loose-envify/download/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
@@ -4335,6 +4359,12 @@ query-string@^6.2.0:
43354359
split-on-first "^1.0.0"
43364360
strict-uri-encode "^2.0.0"
43374361

4362+
raf@^3.1.0:
4363+
version "3.4.1"
4364+
resolved "https://registry.npm.taobao.org/raf/download/raf-3.4.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fraf%2Fdownload%2Fraf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
4365+
dependencies:
4366+
performance-now "^2.1.0"
4367+
43384368
randomatic@^3.0.0:
43394369
version "3.1.1"
43404370
resolved "http://registry.npm.taobao.org/randomatic/download/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
@@ -4512,6 +4542,14 @@ react-native-svg@^9.5.1:
45124542
version "9.5.1"
45134543
resolved "https://registry.npm.taobao.org/react-native-svg/download/react-native-svg-9.5.1.tgz#eb21fa7eb5d71649620541e6549c6ed425d80240"
45144544

4545+
react-native-swipeout@^2.3.6:
4546+
version "2.3.6"
4547+
resolved "https://registry.npm.taobao.org/react-native-swipeout/download/react-native-swipeout-2.3.6.tgz#47dac8a835825cf3f2eef9e495574a3d9ab6d3fa"
4548+
dependencies:
4549+
create-react-class "^15.6.0"
4550+
prop-types "^15.5.10"
4551+
react-tween-state "^0.1.5"
4552+
45154553
react-native-tab-view@^1.2.0, react-native-tab-view@^1.3.4:
45164554
version "1.3.4"
45174555
resolved "http://registry.npm.taobao.org/react-native-tab-view/download/react-native-tab-view-1.3.4.tgz#63fc3eb09652651d0ea0e016cff0f3a5e535f4de"
@@ -4637,6 +4675,13 @@ react-transform-hmr@^1.0.4:
46374675
global "^4.3.0"
46384676
react-proxy "^1.1.7"
46394677

4678+
react-tween-state@^0.1.5:
4679+
version "0.1.5"
4680+
resolved "https://registry.npm.taobao.org/react-tween-state/download/react-tween-state-0.1.5.tgz#e98b066551efb93cb92dd1be14995c2e3deae339"
4681+
dependencies:
4682+
raf "^3.1.0"
4683+
tween-functions "^1.0.1"
4684+
46404685
react@16.8.3:
46414686
version "16.8.3"
46424687
resolved "http://registry.npm.taobao.org/react/download/react-16.8.3.tgz#c6f988a2ce895375de216edcfaedd6b9a76451d9"
@@ -5416,6 +5461,10 @@ tunnel-agent@^0.6.0:
54165461
dependencies:
54175462
safe-buffer "^5.0.1"
54185463

5464+
tween-functions@^1.0.1:
5465+
version "1.2.0"
5466+
resolved "https://registry.npm.taobao.org/tween-functions/download/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff"
5467+
54195468
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
54205469
version "0.14.5"
54215470
resolved "http://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"

0 commit comments

Comments
 (0)