상세 컨텐츠

본문 제목

react native ImagePicker 코드 예제

react-native

by RNDK 2023. 1. 19. 10:40

본문

 

//react-native-ImagePicker 설치이후 진행

    selectImage = async () => {

        ImagePicker.launchImageLibrary(

            {

                mediaType: 'photo',

                includeBase64: true,

                maxHeight: 200,

                maxWidth: 200,

            },

            (response) => {

                console.log(response);

                this.setState({ image: response });

            },

        )

    }

    /**

     * Select video & store in state

     */

    selectVideo = async () => {

        ImagePicker.launchImageLibrary({ mediaType: 'video', includeBase64: true }, (response) => {

            console.log(response);

            this.setState({ video: response });

        })

    }

관련글 더보기

댓글 영역