Skip to content

Commit ca376f6

Browse files
author
杨楠
committed
style:Update local code
1 parent f3b58ae commit ca376f6

File tree

3 files changed

+3
-46
lines changed

3 files changed

+3
-46
lines changed

example/examples/src/routes/Ellipsis/index.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ export default class DividerView extends React.Component<DividerViewProps> {
3434
</Ellipsis>
3535
</WingBlank>
3636
</Card>
37-
<Card title="点击展示文本全部内容">
38-
<WingBlank>
39-
<Ellipsis maxLen={5} placeholder="。。。。">
40-
用于文本过长,超出长度显示 用于文本过长,超出长度显示
41-
用于文本过长,超出长度显示 用于文本过长,超出长度显示
42-
</Ellipsis>
43-
</WingBlank>
44-
</Card>
4537
</Body>
4638
<Footer />
4739
</Layout>

packages/core/src/Ellipsis/index.tsx

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,19 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { View, Text, TextProps, Dimensions, TouchableOpacity } from 'react-native';
4-
import Icon from '../Icon';
5-
import { right } from './svg';
6-
import MaskLayer from '../MaskLayer';
3+
import { Text, TextProps } from 'react-native';
74

8-
let MainHeight = Dimensions.get('window').height;
95
export interface EllipsisProps extends TextProps {
106
children?: React.ReactNode;
117
placeholder?: string;
128
maxLen?: number;
139
}
1410

1511
export default function Ellipsis({ maxLen, children, placeholder, ...props }: EllipsisProps) {
16-
const [modalVisible, setModalVisible] = useState(false);
17-
// let content1 = Number(children.length);
18-
1912
let content = children;
2013
if (maxLen && content && typeof content === 'string') {
2114
content = content.length > maxLen ? content.substr(0, maxLen) + placeholder : content;
2215
}
23-
24-
return (
25-
<>
26-
<MaskLayer visible={modalVisible} onDismiss={() => setModalVisible(false)}>
27-
<View
28-
style={{
29-
backgroundColor: '#fff',
30-
justifyContent: 'center',
31-
alignItems: 'center',
32-
marginTop: MainHeight * 0.2,
33-
padding: 20,
34-
}}
35-
>
36-
<Text style={{ fontSize: 17 }}>{children}</Text>
37-
</View>
38-
</MaskLayer>
39-
40-
<TouchableOpacity
41-
style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}
42-
onPress={() => setModalVisible(true)}
43-
>
44-
<Text {...props}>{content}</Text>
45-
<Icon name="right" size={14} />
46-
</TouchableOpacity>
47-
</>
48-
);
16+
return <Text {...props}>{content}</Text>;
4917
}
5018

5119
Ellipsis.propTypes = {

packages/core/src/Ellipsis/svg.tsx

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)