Fix inline styles warning in Libraries (#22161)
Summary: Fixes `react-native/no-inline-styles` eslint warnings in the `Libraries` module. Pull Request resolved: https://github.com/facebook/react-native/pull/22161 Differential Revision: D12946899 Pulled By: TheSavior fbshipit-source-id: c97ffa50dd90529dabf30a3d2cb09476acc568cb
This commit is contained in:
parent
69213eea95
commit
41eb2da33b
|
@ -14,6 +14,7 @@ const Platform = require('Platform');
|
||||||
const Position = require('Position');
|
const Position = require('Position');
|
||||||
const React = require('React');
|
const React = require('React');
|
||||||
const ReactNative = require('ReactNative');
|
const ReactNative = require('ReactNative');
|
||||||
|
const StyleSheet = require('StyleSheet');
|
||||||
const TVEventHandler = require('TVEventHandler');
|
const TVEventHandler = require('TVEventHandler');
|
||||||
const TouchEventUtils = require('fbjs/lib/TouchEventUtils');
|
const TouchEventUtils = require('fbjs/lib/TouchEventUtils');
|
||||||
const UIManager = require('UIManager');
|
const UIManager = require('UIManager');
|
||||||
|
@ -858,17 +859,25 @@ const Touchable = {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
pointerEvents="none"
|
pointerEvents="none"
|
||||||
style={{
|
style={[
|
||||||
position: 'absolute',
|
styles.debug,
|
||||||
borderColor: hexColor.slice(0, -2) + '55', // More opaque
|
{
|
||||||
borderWidth: 1,
|
borderColor: hexColor.slice(0, -2) + '55', // More opaque
|
||||||
borderStyle: 'dashed',
|
backgroundColor: hexColor.slice(0, -2) + '0F', // Less opaque
|
||||||
backgroundColor: hexColor.slice(0, -2) + '0F', // Less opaque
|
...debugHitSlopStyle,
|
||||||
...debugHitSlopStyle,
|
},
|
||||||
}}
|
]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
debug: {
|
||||||
|
position: 'absolute',
|
||||||
|
borderWidth: 1,
|
||||||
|
borderStyle: 'dashed',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = Touchable;
|
module.exports = Touchable;
|
||||||
|
|
|
@ -777,11 +777,7 @@ class CellRenderer extends React.Component<CellProps> {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
infoLog('render cell ' + this.props.rowIndex);
|
infoLog('render cell ' + this.props.rowIndex);
|
||||||
const Text = require('Text');
|
const Text = require('Text');
|
||||||
debug = (
|
debug = <Text style={styles.debug}>Row: {this.props.rowIndex}</Text>;
|
||||||
<Text style={{backgroundColor: 'lightblue'}}>
|
|
||||||
Row: {this.props.rowIndex}
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
const style = this._includeInLayoutLatch ? styles.include : styles.remove;
|
const style = this._includeInLayoutLatch ? styles.include : styles.remove;
|
||||||
return (
|
return (
|
||||||
|
@ -819,6 +815,9 @@ const styles = StyleSheet.create({
|
||||||
right: -removedXOffset,
|
right: -removedXOffset,
|
||||||
opacity: DEBUG ? 0.1 : 0,
|
opacity: DEBUG ? 0.1 : 0,
|
||||||
},
|
},
|
||||||
|
debug: {
|
||||||
|
backgroundColor: 'lightblue',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = WindowedListView;
|
module.exports = WindowedListView;
|
||||||
|
|
|
@ -954,7 +954,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||||
);
|
);
|
||||||
if (this.props.debug) {
|
if (this.props.debug) {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={styles.debug}>
|
||||||
{ret}
|
{ret}
|
||||||
{this._renderDebugOverlay()}
|
{this._renderDebugOverlay()}
|
||||||
</View>
|
</View>
|
||||||
|
@ -1194,47 +1194,41 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||||
const windowLen = frameLast.offset + frameLast.length - windowTop;
|
const windowLen = frameLast.offset + frameLast.length - windowTop;
|
||||||
const visTop = this._scrollMetrics.offset;
|
const visTop = this._scrollMetrics.offset;
|
||||||
const visLen = this._scrollMetrics.visibleLength;
|
const visLen = this._scrollMetrics.visibleLength;
|
||||||
const baseStyle = {position: 'absolute', top: 0, right: 0};
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={[styles.debugOverlayBase, styles.debugOverlay]}>
|
||||||
style={{
|
|
||||||
...baseStyle,
|
|
||||||
bottom: 0,
|
|
||||||
width: 20,
|
|
||||||
borderColor: 'blue',
|
|
||||||
borderWidth: 1,
|
|
||||||
}}>
|
|
||||||
{framesInLayout.map((f, ii) => (
|
{framesInLayout.map((f, ii) => (
|
||||||
<View
|
<View
|
||||||
key={'f' + ii}
|
key={'f' + ii}
|
||||||
style={{
|
style={[
|
||||||
...baseStyle,
|
styles.debugOverlayBase,
|
||||||
left: 0,
|
styles.debugOverlayFrame,
|
||||||
top: f.offset * normalize,
|
{
|
||||||
height: f.length * normalize,
|
top: f.offset * normalize,
|
||||||
backgroundColor: 'orange',
|
height: f.length * normalize,
|
||||||
}}
|
},
|
||||||
|
]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<View
|
<View
|
||||||
style={{
|
style={[
|
||||||
...baseStyle,
|
styles.debugOverlayBase,
|
||||||
left: 0,
|
styles.debugOverlayFrameLast,
|
||||||
top: windowTop * normalize,
|
{
|
||||||
height: windowLen * normalize,
|
top: windowTop * normalize,
|
||||||
borderColor: 'green',
|
height: windowLen * normalize,
|
||||||
borderWidth: 2,
|
},
|
||||||
}}
|
]}
|
||||||
/>
|
/>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={[
|
||||||
...baseStyle,
|
styles.debugOverlayBase,
|
||||||
left: 0,
|
styles.debugOverlayFrameVis,
|
||||||
top: visTop * normalize,
|
{
|
||||||
height: visLen * normalize,
|
top: visTop * normalize,
|
||||||
borderColor: 'red',
|
height: visLen * normalize,
|
||||||
borderWidth: 2,
|
},
|
||||||
}}
|
]}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -1785,6 +1779,34 @@ const styles = StyleSheet.create({
|
||||||
horizontallyInverted: {
|
horizontallyInverted: {
|
||||||
transform: [{scaleX: -1}],
|
transform: [{scaleX: -1}],
|
||||||
},
|
},
|
||||||
|
debug: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
debugOverlayBase: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
},
|
||||||
|
debugOverlay: {
|
||||||
|
bottom: 0,
|
||||||
|
width: 20,
|
||||||
|
borderColor: 'blue',
|
||||||
|
borderWidth: 1,
|
||||||
|
},
|
||||||
|
debugOverlayFrame: {
|
||||||
|
left: 0,
|
||||||
|
backgroundColor: 'orange',
|
||||||
|
},
|
||||||
|
debugOverlayFrameLast: {
|
||||||
|
left: 0,
|
||||||
|
borderColor: 'green',
|
||||||
|
borderWidth: 2,
|
||||||
|
},
|
||||||
|
debugOverlayFrameVis: {
|
||||||
|
left: 0,
|
||||||
|
borderColor: 'red',
|
||||||
|
borderWidth: 2,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = VirtualizedList;
|
module.exports = VirtualizedList;
|
||||||
|
|
Loading…
Reference in New Issue