This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/App.tsx | |
import { StyleSheet, Text, View } from 'react-native'; | |
import Hello1 from './Hello'; | |
import Hello2 from './components/Hello'; | |
export default function App() { | |
return ( | |
<View style={styles.container}> | |
<Text>App</Text> | |
<Hello1 /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/App.tsx | |
import { StyleSheet, Text, View } from 'react-native'; | |
import Hello1 from './Hello'; | |
import Hello2 from './components/Hello'; | |
export default function App() { | |
return ( | |
<View style={styles.container}> | |
<Text>App</Text> | |
<Hello1 /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/App.tsx | |
import { StyleSheet, Text, View } from 'react-native'; | |
import Hello1 from './Hello'; | |
import Hello2 from './components/Hello'; | |
export default function App() { | |
return ( | |
<View style={styles.container}> | |
<Text>App</Text> | |
<Hello1 /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insertBefore(parentInstance, child, beforeChild) { | |
var children = parentInstance._children; | |
var index = children.indexOf(child); // Move existing child or add new child? | |
if (index >= 0) { | |
children.splice(index, 1); | |
var beforeChildIndex = children.indexOf(beforeChild); | |
children.splice(beforeChildIndex, 0, child); | |
ReactNativePrivateInterface.UIManager.manageChildren( // 요기 !! | |
parentInstance._nativeTag, // containerID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onPress={()=>{ | |
if(scrollTo !== undefined) { | |
Keyboard.addListener("keyboardDidShow", (event) => { | |
const platformOffset = Platform.OS === "ios" ? 95 : 165; // 플랫폼별로 오차 조절 | |
scrollTo(getPosition() - (constants.height - event.endCoordinates.height - platformOffset)); | |
Keyboard.removeAllListeners("keyboardDidShow"); | |
}); | |
} | |
GoComment(); // Comment 스크린으로 이동 | |
}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostPresenter extends Component { | |
render() { | |
return ( | |
<PostPresenterInside | |
... | |
scrollTo={this.props.scrollTo} | |
... | |
/> | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default() => { | |
const scrollView = useRef(); | |
const scrollTo = (position) => { | |
scrollView | |
.current | |
.scrollTo({x: 0, y: position, animated: true}); | |
} | |
return ( | |
<KeyboardAvoidingView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PostPresenterInside = ({ | |
..., | |
setY, | |
setOffset, | |
getPosition | |
}) => { | |
... | |
return ( | |
<Container onLayout={event => { | |
const layout = event.nativeEvent.layout; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Container onLayout={event => { | |
const layout = event.nativeEvent.layout; | |
// layout.y를 어딘가에 저장 | |
}}> | |
... | |
<CommentInputContainer onLayout={event => { | |
const layout = event.nativeEvent.layout; | |
// layout.y를 어딘가에 저장 | |
}}> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let selectedPhotos = []; // 전역 변수 | |
/* 아래는 컴포넌트 함수 내부의 함수 */ | |
const addPhoto = photo => { | |
selectedPhotos = selectedPhotos.concat(photo); | |
setSelectedPhoto(photo); | |
} | |
const deletePhoto = photo => { | |
selectedPhotos.splice(selectedPhotos.findIndex(p => p.id === photo.id), 1); |
NewerOlder