26 lines
672 B
JavaScript
26 lines
672 B
JavaScript
/* eslint-disable no-console */
|
|
const fs = require('fs');
|
|
|
|
try {
|
|
console.log('React spring scroll view fix...');
|
|
const rootDir = process.cwd();
|
|
|
|
const file = `${rootDir}/node_modules/react-native-spring-scrollview/SpringScrollView.js`;
|
|
const data = fs.readFileSync(file, 'utf8');
|
|
const dataFix = 'react-native/Libraries/Components/TextInput/TextInputState';
|
|
|
|
if (data.indexOf(dataFix) !== -1) {
|
|
// eslint-disable-next-line no-throw-literal
|
|
throw '> Already fixed';
|
|
}
|
|
|
|
const result = data.replace(
|
|
/react-native\/lib\/TextInputState/g,
|
|
dataFix,
|
|
);
|
|
fs.writeFileSync(file, result, 'utf8');
|
|
console.log('> Done');
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|