Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions RNTester/js/TextExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
'use strict';

const Platform = require('Platform');
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var {Text, TextInput, View, LayoutAnimation, Button} = ReactNative;
const React = require('react');
const ReactNative = require('react-native');
const {Text, TextInput, View, LayoutAnimation, Button} = ReactNative;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

const TextLegend = require('./Shared/TextLegend');

type TextAlignExampleRTLState = {|
Expand Down Expand Up @@ -122,12 +121,20 @@ class AttributeToggler extends React.Component<{}, $FlowFixMeState> {
}
}

var AdjustingFontSize = createReactClass({
displayName: 'AdjustingFontSize',
getInitialState: function() {
return {dynamicText: '', shouldRender: true};
},
reset: function() {
type AdjustingFontSizeState = {|
dynamicText: string,
shouldRender: boolean,
|};

class AdjustingFontSize extends React.Component<{}, AdjustingFontSizeState> {
static displayName: ?string = 'AdjustingFontSize';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, no need for this.


state = {
dynamicText: '',
shouldRender: true,
};

reset = () => {
LayoutAnimation.easeInEaseOut();
this.setState({
shouldRender: false,
Expand All @@ -139,23 +146,26 @@ var AdjustingFontSize = createReactClass({
shouldRender: true,
});
}, 300);
},
addText: function() {
};

addText = () => {
this.setState({
dynamicText:
this.state.dynamicText +
(Math.floor((Math.random() * 10) % 2) ? ' foo' : ' bar'),
});
},
removeText: function() {
};

removeText = () => {
this.setState({
dynamicText: this.state.dynamicText.slice(
0,
this.state.dynamicText.length - 4,
),
});
},
render: function() {
};

render() {
if (!this.state.shouldRender) {
return <View />;
}
Expand Down Expand Up @@ -221,8 +231,8 @@ var AdjustingFontSize = createReactClass({
</View>
</View>
);
},
});
}
}

class TextBaseLineLayoutExample extends React.Component<*, *> {
render() {
Expand Down