<commit_before>/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    TouchableNativeFeedback,
    View
} from 'react-native';
import ImagePicker from 'react-native-image-picker';
import { ShareDialog } from 'react-native-fbsdk';

const PICKER_OPTIONS = {
    mediaType: 'photo',
    noData: true,
    quality: 0.75,
    title: 'Choose photo',
};

export default class FBSDKTest extends Component {
    // Share the link using the share dialog.
    _sharePhotoWithShareDialog = shareContent => {
        ShareDialog.canShow(shareContent).then(
            function(canShow) {
                if (canShow) {
                    return ShareDialog.show(shareContent);
                }
            }
        ).then(
            function(result) {
                console.log(result);
                if (result.isCancelled) {
                    alert('Share cancelled');
                } else {
                    alert('Share success with postId: '
                    + result.postId);
                }
            },
            function(error) {
                alert('Share fail with error: ' + error);
            }
        );
    }

    _showImageGallery = () => {
        ImagePicker.launchImageLibrary(PICKER_OPTIONS, (response)  => {
            if (response.didCancel) {
                console.log('User cancelled image picker');
            }
            else if (response.error) {
                console.log('ImagePicker Error: ', response.error);
            }
            else {
                // Build up a shareable photo.
                const sharePhotoContent = {
                    contentType: 'photo',
                    photos: [
                        {
                            imageUrl: response.uri,
                            userGenerated: false,
                            caption: "FBSDK test on Android"
                        }
                    ]
                };

                this._sharePhotoWithShareDialog(sharePhotoContent);
            }
        });
    }

    render() {
        return (
            <View style={styles.container}>
                <TouchableNativeFeedback onPress={() => this._showImageGallery()}>
                    <View style={styles.button}>
                        <Text style={styles.buttonText}>
                            FBSDK Test
                        </Text>
                    </View>
                </TouchableNativeFeedback>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    button: {
        backgroundColor: '#ccc',
        borderRadius: 2,
        elevation: 2
    },
    buttonText: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});

AppRegistry.registerComponent('FBSDKTest', () => FBSDKTest);
<commit_msg>Update android version source code.<commit_after>/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    TouchableNativeFeedback,
    View
} from 'react-native';
import ImagePicker from 'react-native-image-picker';
import { ShareDialog } from 'react-native-fbsdk';

const PICKER_OPTIONS = {
    mediaType: 'photo',
    noData: true,
    quality: 0.75,
    title: 'Choose photo',
};

export default class FBSDKTest extends Component {
    // Share the photo using the share dialog.
    _sharePhotoWithShareDialog = shareContent => {
        ShareDialog.canShow(shareContent).then(
            function(canShow) {
                if (canShow) {
                    return ShareDialog.show(shareContent);
                }
            }
        ).then(
            function(result) {
                console.log(result);
                if (!result) {
                    alert('Share result is undefined!');
                } else {
                    if (result.isCancelled) {
                        alert('Share cancelled by user');
                    } else {
                        alert('Share success with postId: '
                        + result.postId);
                    }
                }
            },
            function(error) {
                alert('Share fail with error: ' + error);
            }
        );
    }

    _showImageGallery = () => {
        ImagePicker.launchImageLibrary(PICKER_OPTIONS, (response)  => {
            if (response.didCancel) {
                alert('User cancelled image picker');
            }
            else if (response.error) {
                alert('ImagePicker Error: ' + response.error);
            }
            else {
                // Build up a shareable photo.
                const sharePhotoContent = {
                    contentType: 'photo',
                    photos: [
                        {
                            imageUrl: response.uri,
                            userGenerated: false,
                            caption: "FBSDK test on Android"
                        }
                    ]
                };

                this._sharePhotoWithShareDialog(sharePhotoContent);
            }
        });
    }

    render() {
        return (
            <View style={styles.container}>
                <TouchableNativeFeedback onPress={() => this._showImageGallery()}>
                    <View style={styles.button}>
                        <Text style={styles.buttonText}>
                            FBSDK Test
                        </Text>
                    </View>
                </TouchableNativeFeedback>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    button: {
        backgroundColor: '#ccc',
        borderRadius: 2,
        elevation: 2
    },
    buttonText: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
});

AppRegistry.registerComponent('FBSDKTest', () => FBSDKTest);

{'fraction_non_alphanumeric': 0.10532818532818533, 'fraction_numerical': 0.0055598455598455596, 'mean_word_length': 1.304626334519573, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6564357', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1594, 'n_words': 347}